#if !defined(MOUSECTRACERMANGERIMPL4_H_INCLUDED)
#define MOUSECTRACERMANGERIMPL4_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "MouseTracerManager.h"

#pragma warning(push)
#pragma warning(disable: 4786)

// forward reference;
template<class T>
class CMouseTracer;

/**
 *	CMouseTracerManagerImpl4 class
 *
 *	Type 3 : setup application hook to monitor mouse activities, especially button down message,
 *				to note the timiing at which CMouseTracer<CMouseTracerManager<CMouseTracerManagerImpl4> >-hook will be installed/removed dynamically on the active window
 *
 */
class CMouseTracerManagerImpl4
{
	friend class CMouseTracerManager<CMouseTracerManagerImpl4>;

public:
	static BOOL SetupMouseTracer(HINSTANCE hMod = NULL) { return CMouseTracerManagerImpl4::Instance().Setup(hMod); }
	static void RemoveMouseTracer() { CMouseTracerManagerImpl4::Instance().Remove(); }

protected:
	static CMouseTracerManagerImpl4 &Instance() { static CMouseTracerManagerImpl4 instance; return instance; }

public:
	CMouseTracerManagerImpl4();
	virtual ~CMouseTracerManagerImpl4();

private:
	BOOL Setup(HINSTANCE hMod = NULL);
	void Remove();

private:
	static LRESULT CALLBACK MouseProc(int nCode, WPARAM wParam, LPARAM lParam);
	static LRESULT CALLBACK CallWndProcRet(int nCode, WPARAM wParam, LPARAM lParam);
	
    static HHOOK m_hHookMouse;
    static HHOOK m_hHookCallWndRet;
	static CMouseTracer<CMouseTracerManager<CMouseTracerManagerImpl4> > *m_pTracer;
};

#pragma warning(pop)

#endif // !defined(MOUSETRACERMANGERIMPL4_H_INCLUDED)
